﻿import QtQuick 2.0
import QtQuick 2.12
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Window 2.12
import QtMultimedia 5.14

Window {
    id:comuWindowId
    width: 640
    height: 480
    visible: true
    title: qsTr("视频播放窗口")
    property string moviePath: ""
    onVisibleChanged: {
        //窗口显示就播放视频 不显示就停止视频
        if(visible) {
            mediaPlayer.play()
        }else {
            mediaPlayer.stop()
        }
    }

    Rectangle {
       color: "black"
       anchors.fill: parent

       MediaPlayer {
           id: mediaPlayer
           source: moviePath
           autoPlay: true
       }

       VideoOutput {
           id: video
           anchors.fill: parent
           source: mediaPlayer
       }
   }
}
